//
//  ActivityModel.m
//  UI 作业 - 豆瓣电影
//
//  Created by hesiyao on 15/12/22.
//  Copyright © 2015年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "ActivityModel.h"

@implementation ActivityModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"owner"]) {
        self.name = value[@"name"];
    }
}

-(void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_title forKey:@"_title"];
    [aCoder encodeObject:_address forKey:@"_address"];
    [aCoder encodeObject:_category_name forKey:@"_category_name"];
    [aCoder encodeObject:_begin_time forKey:@"_begin_time"];
    [aCoder encodeObject:_end_time forKey:@"_end_time"];
    [aCoder encodeObject:_participant_count forKey:@"_participant_count"];
    [aCoder encodeObject:_wisher_count forKey:@"_wisher_count"];
    [aCoder encodeObject:_image forKey:@"_image"];
    [aCoder encodeObject:_content forKey:@"_content"];
    [aCoder encodeObject:_name forKey:@"_name"];
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super init];
    if (self) {
        self.title = [coder decodeObjectForKey:@"_title"];
        self.address = [coder decodeObjectForKey:@"_address"];
        self.category_name = [coder decodeObjectForKey:@"_category_name"];
        self.begin_time = [coder decodeObjectForKey:@"_begin_time"];
        self.end_time = [coder decodeObjectForKey:@"_end_time"];
        self.participant_count = [coder decodeObjectForKey:@"_participant_count"];
        self.wisher_count = [coder decodeObjectForKey:@"_wisher_count"];
        self.image = [coder decodeObjectForKey:@"_image"];
        self.content = [coder decodeObjectForKey:@"_content"];
        self.name = [coder decodeObjectForKey:@"_name"];
    }
    return self;
}

@end
